//
//  NSObject+EventBus.h
//  Express
//
//  Created by lhongl on 2025/9/25.
//  Copyright © 2025 QM. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface NSObject (EventBus)

/// 注册事件线
/// - Parameters:
///   - name: 事件名称
///   - completion: 结果
- (void)registerEventBusWithName:(NSString *)name
                     completion:(void(^)(NSDictionary  *info))completion;

- (void)registerAsyncEventBusWithName:(NSString *)name
                          completion:(void(^)(NSDictionary  *info))completion;


/// 发送消息
/// - Parameter name: 事件名称
- (void)postEventBusWithName:(NSString *)name;

- (void)postAsyncEventBusWithName:(NSString *)name;


/// 消息
/// - Parameters:
///   - name: 事件名称
///   - info: 参数
- (void)postEventBusWithName:(NSString *)name
                       info:(NSDictionary * _Nullable)info;

- (void)postAsyncEventBusWithName:(NSString *)name
                       info:(NSDictionary * _Nullable)info;


/// 移除事件
/// - Parameters:
///   - name: 事件名称
- (void)removeEventBusWithName:( NSString * _Nullable)name;

- (void)removeAllEventBus;

@end

NS_ASSUME_NONNULL_END
